﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TaobaoPick
{
    public class WebOPContext
    {

        private int maxPages = 1;
        private bool validSaleOnly = false;
        private int count = 0;
        private String taskTag = "";
        private Guid taskId = Guid.Empty;

        public Guid TaskId
        {
            get { return taskId; }
            set { taskId = value; }
        }

        public String toString()
        {
            String r ="";
            if ("".Equals(taskTag))
            {
                r = "(No Name)";
            }else
                r="("+taskTag+")";
            
            if (maxPages == 1)
            {
                r += " 單頁模式";
            }
            else
            {
                r += " 連續模式";
                if (ValidSaleOnly)
                    r += "  只取有交易項目";
                r +=" 目前" + count+" / "+maxPages;
            }
            return r;
        }

        public String TaskTag
        {
            get { return taskTag; }
            set { taskTag = value; }
        }


        public int MaxPages
        {
            get { return maxPages; }
            set { maxPages = value;
            if (maxPages < 0)
                maxPages = 1;
            }
        }

        public bool ValidSaleOnly
        {
            get { return validSaleOnly; }
            set { validSaleOnly = value; }
        }
        public int Count
        {
            get { return count; }
            set { count = value; }
        }

        public bool next()
        {
            if (count < maxPages)
            {
                count++;
                return true;
            }
            return false;
        }
        public void begin()
        {
            count = 1;
        }



    

 

    }
}
